package com.moss.common.domain;

import com.auth0.jwt.interfaces.DecodedJWT;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * @author gxcc3
 * @date: 2024/8/22 23:20
 */
@Data
public class LoginUser {

    /** 用户id*/
    private String userId;


    private Long orgId;

    /** 用户真实名*/
    private String realName;

    public LoginUser() {
    }

    public LoginUser(String userId, String realName,Long orgId) {
        this.userId = userId;
        this.realName = realName;
        this.orgId = orgId;
    }

    public LoginUser(String userId, String realName) {
        this.userId = userId;
        this.realName = realName;
    }

    public LoginUser(DecodedJWT tokenInfo) {
        this.userId =tokenInfo.getClaim("userId").asString();
        this.realName = tokenInfo.getClaim("realName").asString();
    }
}
